package com.taobao.api.request;

import java.util.Map;

import com.taobao.api.ApiRuleException;
import com.taobao.api.TaobaoRequest;
import com.taobao.api.internal.util.RequestCheckUtils;
import com.taobao.api.internal.util.TaobaoHashMap;
import com.taobao.api.response.WlbOwnstoreAreasChangeResponse;

/**
 * TOP API: taobao.wlb.ownstore.areas.change request
 * 
 * @author auto create
 * @since 1.0, 2013-07-21 16:38:14
 */
public class WlbOwnstoreAreasChangeRequest implements TaobaoRequest<WlbOwnstoreAreasChangeResponse> {

  private Map<String, String> headerMap = new TaobaoHashMap();
  private TaobaoHashMap       udfParams;                      // add
                                                              // user-defined
                                                              // text parameters
  private Long                timestamp;

  /**
   * 例子：510000,140000
   */
  private String              areaCodes;

  /**
   * 要设置区域的对应的订阅服务code
   */
  private String              serviceCode;

  /**
   * 区域设置类型：如添加、删除。 如添加区域，请设值为ADD； 如删除区域，请设值为DELETE
   */
  private String              type;

  public void setAreaCodes(String areaCodes) {
    this.areaCodes = areaCodes;
  }

  public String getAreaCodes() {
    return this.areaCodes;
  }

  public void setServiceCode(String serviceCode) {
    this.serviceCode = serviceCode;
  }

  public String getServiceCode() {
    return this.serviceCode;
  }

  public void setType(String type) {
    this.type = type;
  }

  public String getType() {
    return this.type;
  }

  public Long getTimestamp() {
    return this.timestamp;
  }

  public void setTimestamp(Long timestamp) {
    this.timestamp = timestamp;
  }

  public String getApiMethodName() {
    return "taobao.wlb.ownstore.areas.change";
  }

  public Map<String, String> getTextParams() {
    TaobaoHashMap txtParams = new TaobaoHashMap();
    txtParams.put("area_codes", this.areaCodes);
    txtParams.put("service_code", this.serviceCode);
    txtParams.put("type", this.type);
    if (this.udfParams != null) {
      txtParams.putAll(this.udfParams);
    }
    return txtParams;
  }

  public void putOtherTextParam(String key, String value) {
    if (this.udfParams == null) {
      this.udfParams = new TaobaoHashMap();
    }
    this.udfParams.put(key, value);
  }

  public Class<WlbOwnstoreAreasChangeResponse> getResponseClass() {
    return WlbOwnstoreAreasChangeResponse.class;
  }

  public void check() throws ApiRuleException {
    RequestCheckUtils.checkNotEmpty(areaCodes, "areaCodes");
    RequestCheckUtils.checkMaxListSize(areaCodes, 50, "areaCodes");
    RequestCheckUtils.checkMaxLength(areaCodes, 600, "areaCodes");
    RequestCheckUtils.checkNotEmpty(serviceCode, "serviceCode");
    RequestCheckUtils.checkNotEmpty(type, "type");
    RequestCheckUtils.checkMaxLength(type, 8, "type");
  }

  public Map<String, String> getHeaderMap() {
    return headerMap;
  }
}
